#!/usr/bin/python3

import docx

from config_info import ConfigInfo
from docx_utils import Doc
from excel_info import ExcelInfo

print("docx version: " + docx.__version__)


def load_config():
    return ConfigInfo()


def main():
    user_config = load_config()
    doc = Doc(path="./", name=user_config.data['target']['name'], target_config=user_config.data['target'])

    src_excel_files = user_config.data['files']

    all_excel_info = []

    for src in src_excel_files:
        print("excel name: " + src['name'])
        info = ExcelInfo(path='./', excel_info=src)
        all_excel_info.append(info)
        pass

    for info in all_excel_info:
        doc.create_table(info)
        pass

    doc.save_doc()
    pass


if __name__ == "__main__":
    main()
    pass
